import $public from "./public.js"
export default {
	baseUrl: 'https://napi.6scx.com/lscx-passenger/',
	user:{
		"getUserByCode":"wxxcx/user/getUserByCode", //微信小程序登录
		"bindTelephone":"wxxcx/user/bindTelephone", //微信小程序绑定手机号
		"getinfo":"user/getinfo", // 根据Token获取用户信息
		"getlist":"user/passenger/getlist", //获取常用联系人列表
		"addlist":"user/passenger/add", //新增常用联系人
	},
	public:{
		"getCityList":"/intercity/line/getCityList", //获取城市列表
		"getCityIsOpen":"/intercity/line/getCityIsOpen", //判断该城市是否开通城际线路
		"getlist":"user/emergency_contact/getlist", //获取紧急联系人列表
		"addlist":"user/emergency_contact/add", //添加紧急联系人
		"sendSms":"sendsms/sendSms", //发送短信
		"setPassWord":"user/setPassWord", //设置用户密码
		"userSet":"address/user/set", //用户设置常用地址接口 
		"logOut":"jwt/logout", //用户退出
		"imagesUp":"upload/images/up", //用户端图片上传
		"appconfig":"get/appconfig", //全局配置接口
	},
	intercity: {
		"getOrderRemarksList":"intercity/line/getOrderRemarksList", //获取行程备注列表
		"getlist":"coupon/user/getlist", //获取用户的优惠券列表
		"getinfo":"coupon/user/getinfo", //获取用户的优惠券详情
		"getLineToPlaceList":"intercity/line/getLineToPlaceList", //根据线路ID和行程方向返回途径点列表
	},
	order: {
		"getOrderPrice":"order/getOrderPrice", // 城际专车：计算订单费用接口
		"subOrder":"order/subOrder", // 城际专车：用户下单接口
		"list":"order/list", //根据用户id获取订单列表
		"intercityinfo":"order/intercity/info", //根据订单id获取城际订单详情
		"subInsideOrder":"order/inside/subInsideOrder", //市内约车：用户下单接口
		"getpriceinfo":"order/inside/getpriceinfo", //市内约车：获取费用明细接口
		"insideInfo":"order/inside/info", //根据订单id获取市内订单详情
		"cancelReturn":"order/user/cancel/ReturnMsg/intercity", //用户取消订单前-返回信息
		"getReason":"order/user/cancel/getReason", // 获取用户取消订单原因
		"cancelSub":"order/user/cancel/sub", //用户取消订单操作
		"paySub":"order/inside/pay/sub", //市内约车提交接口
		"getEvaluateTageList":"evaluate/order/getEvaluateTageList", // 获取评价标签
		"subEvaluate":"evaluate/order/user/sub", //用户订单评价
		"shareAdd":"order/share/add", //市内网约车-分享行程操作
		"shareInfo":"order/share/info", //市内网约车-行程分享查看
		"returnIntercity":"order/user/cancel/ReturnMsg/intercity", //城际专车：用户取消订单前-返回信息
	},
	invoice: {
		"getorderList":"invoice/getorder/list", //获取可开票订单列表
		"gethelpinfo":"invoice/gethelpinfo", //获取开票帮助
		"getlist":"invoice/getlist", //获取开票历史列表
		"pricesum":"invoice/getorder/pricesum", //获取选取订单的金额和列表信息
		"addInvoice":"invoice/add", //提交发票信息
		"getinfo":"invoice/getinfo", //获取开票详情
	},
	customer: {
		"orderlist":"customer/service/get/orderlist", //客服中心-获取可选择售后订单列表
		"typeandinfo":"customer/service/get/typeandinfo", //客服中心-获取订单详情和服务类型列表
		"servicetypeinfo":"customer/service/get/servicetypeinfo", //客服中心-获取订单详情和服务类型详情
		"feedback_info":"customer/service/sub/feedback_info", //客服中心-问题反馈提交
		"feedback_list":"customer/service/get/feedback_list", //客服中心-获取问题反馈列表
		"feedback_info":"customer/service/get/feedback_info", //客服中心-获取问题反馈详情
	},
	async request(url,data={},method='post'){
		uni.showLoading()
		if(!data.userId){
			data.userId = uni.getStorageSync('userInfo').id;	
		}
		if(!data.uid){
			data.uid = uni.getStorageSync('userInfo').id;
		}
		url = this.baseUrl + url;
		let [error,result] = await uni.request({
			url:url,
			data:data,
			method:method,
			header:{
				'Authorization': uni.getStorageSync('token'),
				'Content-Type':'application/json'
			}
		})
		if(result.statusCode == 200){
			uni.hideLoading();
			if(result.data.statusCode == 200){
				// uni.hideLoading();
				return result.data.data;
			}else{
				// uni.hideLoading();
				return false;
			}
			
		}else{
			uni.hideLoading();
			if(url == 'https://napi.6scx.com/lscx-passenger/order/getOrderPrice'){
				uni.showModal({
					content: '当前线路未开通城际专车,请关注后续进展',
					success() {
						uni.navigateBack()
					}
				})
			}
			// uni.hideLoading();
			return false;
		}
	},
	async wxLogin(){
		
		
	}
}